package cc.verywell.pureblock.util.unsafe;

import java.lang.reflect.Field;

import sun.misc.Unsafe;

/**
* 
* Copyright 2019 TanYaqiu
* @author TanYaqiu 
* @address flat 601
* @date 2019年3月17日 下午11:14:12
*/

public class UnsafeGetMemoryAddressSize implements Runnable{
	
	@Override
	public void run() {
        try {  
            Field field = Unsafe.class.getDeclaredField("theUnsafe");  
            field.setAccessible(true);  
            Unsafe unsafe = (Unsafe) field.get(null);  
            int size = unsafe.addressSize();
            //System.out.println(size);
            if(size>=4) {
            	UnsafeRun.MemoryAddressSize = size;
            	UnsafeRun.isMemoryAddressSize = true;
            }
        } catch (Exception e) {
        	//e.printStackTrace();
		}
	}

}
